package com.h3c.nem.mapper;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.toolkit.Constants;
import com.h3c.nem.dto.TbWorkerGradeDTO;
import com.h3c.nem.dto.mapstruct.NewWorkerDTO;
import com.h3c.nem.entity.SdAllWorker;
import com.h3c.nem.entity.TbWorkerGrade;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import tk.mybatis.mapper.common.Mapper;

import java.util.List;
import java.util.Map;
import java.util.Set;

/**
 * Copyright (C), 2020-2020, h3c
 * FileName: TbWorkerGradeMapper
 *
 * @Author: l22886
 * @Date: 2022-02-23
 * Description: tb_worker_grade mapper
 * Version: 1.0
 */
public interface TbWorkerGradeMapper extends BaseMapper<TbWorkerGrade> {

    /**
     * @title: queryListByFuzzy
     * @description: 模糊列表查询
     * @params: [ TbWorkerGrade ]
     * @return: java.util.List
     * @createTime: 2022-02-23
     * @version: 1.0
     * @author: l22886
     */
    public List<TbWorkerGrade> queryListByFuzzy(TbWorkerGrade TbWorkerGrade);

    /**
     * @title: queryListByFuzzy
     * @description: 精确列表查询
     * @params: [ TbWorkerGrade ]
     * @return: java.util.List
     * @createTime: 2022-02-23
     * @version: 1.0
     * @author: l22886
     */
    public List<TbWorkerGrade> queryList(TbWorkerGrade TbWorkerGrade);

    /**
     * @title: updateTbWorkerGrade
     * @description: 更新
     * @params: [ TbWorkerGrade ]
     * @return: java.lang.Integer
     * @createTime: 2022-02-23
     * @version: 1.0
     * @author: l22886
     */
    public Integer updateTbWorkerGrade(TbWorkerGrade TbWorkerGrade);

    /**
     * @title: insertTbWorkerGrade
     * @description: 插入
     * @params: [ TbWorkerGrade ]
     * @return: java.lang.Integer
     * @createTime: 2022-02-23
     * @version: 1.0
     * @author: l22886
     */
    public Integer insertTbWorkerGrade(TbWorkerGrade TbWorkerGrade);

    /**
     * @title: deleteTbWorkerGrade
     * @description: 删除
     * @params: [ TbWorkerGrade ]
     * @return: java.lang.Integer
     * @createTime: 2022-02-23
     * @version: 1.0
     * @author: l22886
     */
    public Integer deleteTbWorkerGrade(TbWorkerGrade TbWorkerGrade);

    List<TbWorkerGradeDTO> getWorkersByGrade(@Param("deptIds") Set<Integer> deptIds,
                                             @Param("gradeTime") String gradeTime,
                                             @Param("grade1") String a,
                                             @Param("grade2") String s);

    /**
     * 根据时间增量获取人员
     *
     * @param queryWrapper
     * @return java.util.List<java.util.Map < java.lang.String, java.lang.Object>>
     * @author z22968
     * @date 2022-06-13 13:34
     */
    @Select("select saw.*, twg.evaluate_time as origin_create_time from tb_worker_grade twg left join sd_all_worker saw on twg.worker_id = saw.worker_id " +
            "${ew.customSqlSegment}")
    List<NewWorkerDTO> getListByTime(@Param(Constants.WRAPPER) QueryWrapper<TbWorkerGrade> queryWrapper);
}
